<template>
  <div class="bg-gradient-to-br from-blue-900 to-indigo-700 min-h-screen p-4">
    <!-- 路由组件渲染区域 -->
    <router-view />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const username = ref('');
const password = ref('');
const router = useRouter();

const login = async () => {
  // 简单验证
  if (!username.value || !password.value) {
    alert('Please enter both username and password');
    return;
  }

  try {
    // 模拟API调用延迟
    await new Promise(resolve => setTimeout(resolve, 1000));

    console.log('Login successful!');
    // 登录成功，跳转到About页面
    router.push('/about');
  } catch (error) {
    console.error('Login error:', error);
    alert('Login failed. Please try again.');
  }
};
</script>


